/**
 * If there are no bugs, it was created by Chen FengYao on 2018/4/2;
 * Otherwise, I don't know who created it either
 */

public class Test02 {
    public static void main(String[] args) {
        int[] arr = {1, 3, 5, 7, 1};
        // 要把 数组中的 所有 元素  倒序输出
        // 所有数组的题, 大多数都是在玩下标

        // 如果i--
        // 退出的条件 就应该 给i一个下限
        for (int i = arr.length - 1; i >= 0; i--) {
            System.out.println(arr[i]);
        }

        // 最后输出 数组中 所有元素的和
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            sum = sum + arr[i];
        }
        System.out.println(sum);
        int avg = (int) (sum * 1f / arr.length);
        System.out.println(avg);

    }
}
